package edu.sctu.zhu.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.apache.log4j.Logger;
import org.springframework.context.annotation.Bean;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;

/**
 * Created by zhu on 2015/11/11.
 */
@Configuration
@EnableWebMvc
@ComponentScan(basePackages = "edu.sctu.zhu.controller", useDefaultFilters = false)
public class WebUploadConfig extends WebMvcConfigurationSupport{
    /**
     * 配置可上传文件
     */
    private static final Logger logger = Logger
            .getLogger(WebUploadConfig.class);

    @Bean(name="multipartResolver")
    public CommonsMultipartResolver commonsMultipartResolver(){
        logger.info("CommonsMultipartResolver");
        return new CommonsMultipartResolver();
    }
}
